﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true"
    CodeBehind="QL_Lessons.aspx.cs" Inherits="ChineseSchool.Admin.QL_Lessons" ValidateRequest="false" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .form-horizontal .control-label {
            text-align: left;
        }
    </style>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#<%= imgAvatar.ClientID%>').css("vertical-align", "bottom");

            $('#btnChangeImage').click(function () {
                $('.modal').modal('show');
            });

            $('#<%= uploadFile.ClientID%>').change(function () {
                var ulListFile = $('#<%= lstFileUpload.ClientID%>');
                ulListFile.append('<li>' + $(this).val() + '</li>');
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder_Top" runat="server">
    <div class="example-modal">
        <div class="modal">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title">Chọn thay đổi ảnh đại diện</h4>
                    </div>
                    <div class="modal-body">
                        <asp:FileUpload ID="uploadAvatar" runat="server" />
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Đóng</button>
                        <asp:Button ID="btnSelectImage" CssClass="btn btn-primary" Text="Chọn ảnh này!" OnClick="BtnSelectImageClick" runat="server" />
                    </div>
                </div>
            </div>
        </div>
    </div>
    <asp:Panel ID="divAdd" runat="server">
        <div class="row">
            <div class="col-xs-12">
                <div class="box box-info">
                    <div class="box-header with-border">
                        <asp:Label ID="lblTitle" runat="server"></asp:Label>
                    </div>
                    <div class="form-horizontal">
                        <div class="box-body">
                            <div class="form-group">
                                <asp:Label ID="lblCourse" Text="Khóa học:" CssClass="col-sm-2 control-label" runat="server" />
                                <div class="col-sm-10">
                                    <asp:DropDownList ID="ddlCourse" CssClass="form-control" runat="server">
                                    </asp:DropDownList>
                                </div>
                            </div>
                            <div class="form-group">
                                <asp:Label ID="lblUserName" Text="Tên bài học:" CssClass="col-sm-2 control-label" runat="server" />
                                <div class="col-sm-10">
                                    <asp:TextBox runat="server" ID="txtTitle" Text='<%# Bind("UserName") %>' MaxLength="150"
                                        CssClass="form-control"></asp:TextBox>
                                </div>
                            </div>
                            <div class="form-group">
                                <asp:Label ID="lblAvatar" Text="Ảnh đại diện:" CssClass="col-sm-2 control-label" runat="server" />
                                <div class="col-sm-10">
                                    <asp:Image ID="imgAvatar" Width="128" Height="128" runat="server" />
                                    <a href="#" id="btnChangeImage">Đổi ảnh</a>
                                </div>
                            </div>
                            <div class="form-group">
                                <asp:Label ID="lblEmailData" Text="Mô tả ngắn gọn:" CssClass="col-sm-2 control-label" runat="server" />
                                <div class="col-sm-10">
                                    <asp:TextBox runat="server" ID="txtSummary" MaxLength="150"
                                        CssClass="form-control"></asp:TextBox>
                                </div>
                            </div>
                            <div class="form-group">
                                <asp:Label ID="lblPhoneNumber" Text="Nội dung:" CssClass="col-sm-2 control-label" runat="server" />
                                <div class="col-sm-10">
                                    <FCKeditorV2:FCKeditor ID="txtContent" runat="server" Height="400px"></FCKeditorV2:FCKeditor>
                                </div>
                            </div>
                            <div class="form-group">
                                <asp:Label ID="lblIsLock" Text="Hiển thị:" CssClass="col-sm-2 control-label" runat="server" />
                                <div class="col-sm-10">
                                    <div class="radio col-sm-1">
                                        <asp:RadioButton ID="rbYes" runat="server" Text="Có" GroupName="rbLock" />
                                    </div>
                                    <div class="radio col-sm-1">
                                        <asp:RadioButton ID="rbNo" runat="server" Text="Không" GroupName="rbLock" />
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <asp:Label ID="Label1" Text="Upload bài tập:" CssClass="col-sm-2 control-label" runat="server" />
                                <div class="col-sm-3">
                                    <asp:FileUpload ID="uploadFile" runat="server" />
                                </div>
                                <div class="col-sm-1">
                                    <input id="btnUploadFile" type="button" name="Upload file" value="Upload file" />
                                    <asp:Button Text="AA" ID="button111" OnClick="BtnSaveFileClick" runat="server" />
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-2"></div>
                                <div class="col-sm-5">
                                    <ul id="lstFileUpload" runat="server">
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="box-footer">
                            <asp:Button ID="btnNew" Text="Thêm mới" OnClick="BtnNewClicked" CssClass=" btn btn-default" runat="server" />
                            <asp:Button ID="btnEdit" Text="Cập nhật" OnClick="BtnEditClicked" CssClass="btn btn-default"
                                runat="server" />
                            <asp:Button ID="btnCancel" Text="Hủy bỏ" OnClick="btnCancelClicked" CssClass="btn btn-default" runat="server" />
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </asp:Panel>
    <asp:Panel ID="divContent" runat="server">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">Danh sách&nbsp;<asp:Label ID="lblUserTitle" runat="server"></asp:Label>:</h3>
                    </div>
                    <div class="box-body">
                        <asp:GridView ID="grdLessons" runat="server" AutoGenerateColumns="False"
                            AllowPaging="True" EnableModelValidation="True" CssClass="table table-bordered"
                            AllowSorting="True" PageSize="10" ShowHeader="true" ShowHeaderWhenEmpty="true"
                            OnRowCommand="GrdLessonRowCommand" OnRowDeleting="GrdLessonRowDeleting"
                            OnRowEditing="GrdLessonRowEditing" OnPageIndexChanging="GrdLessonPageIndexChanging">
                            <PagerStyle CssClass="grdPaging" BackColor="#F6F6F6" ForeColor="Black" HorizontalAlign="Center"
                                VerticalAlign="Middle" />
                            <Columns>
                                <asp:TemplateField ItemStyle-Width="50px" HeaderText="Stt">
                                    <ItemTemplate>
                                        <%# Container.DataItemIndex + 1 %>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="LessonTitle" HtmlEncode="false" ItemStyle-Width="300px" ReadOnly="true" HeaderText="Tiêu đều bài học" />
                                <asp:BoundField DataField="LessonSummary" HtmlEncode="false" HeaderText="Mô tả ngắn gọn" ReadOnly="true" />
                                <asp:BoundField DataField="PostDate" ItemStyle-Width="120px" HeaderText="Ngày xuất bản" DataFormatString="{0:dd/MM/yyyy}"
                                    HtmlEncode="false" ReadOnly="true" />
                                <asp:TemplateField ItemStyle-Width="30px" HeaderText="Sửa" ItemStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="imgedit" runat="server" ImageUrl="Images/edit.png" ToolTip="Sửa thông tin"
                                            CommandArgument='<%# Eval("LessonID") %>' CommandName="Edit" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField ItemStyle-Width="30px" HeaderText="Xóa" ItemStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="imgDel" runat="server" ImageUrl="Images/del.gif" ToolTip="Xóa danh mục"
                                            CommandArgument='<%# Eval("LessonID") %>' CommandName="Delete" OnClientClick=" return confirm('Bạn có chắc chắn muốn xoá?') " />
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                        <div class="text-left">
                            <b>
                                <asp:Label ID="lbl_count" runat="server" Visible="false"></asp:Label></b>
                        </div>
                    </div>
                    <div class="box-footer clearfix">
                        <div class="col-xs-6 text-left">
                            <i>Bạn đang xem trang
                            <%=grdLessons.PageCount==0 &&  grdLessons.PageIndex == 0 ? 0 : grdLessons.PageIndex+1%>
                            của
                            <%=grdLessons.PageCount%></i>
                        </div>
                        <div class="col-xs-6 text-right">
                            <asp:Button ID="btnAddnew" Text="Thêm mới" OnClick="btnAddnewClicked" runat="server" />
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </asp:Panel>
</asp:Content>
